package com.fancy.controller;

import com.fancy.pojo.User;
import com.fancy.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.fancy.utils.QiniuUtils;

@RestController
@RequestMapping("/user")
public class UserInfoController {

    @Autowired
    private IUserInfoService userInfoService;
    @Autowired
    QiniuUtils qiniuUtils;

    @RequestMapping("/update")
    public boolean updateUserInfo(@RequestBody User user) {
        return userInfoService.updeteUserInfo(user);
    }

    @RequestMapping("/upload")
    public String Upload(@RequestParam("file") MultipartFile multipartFile) {

//        System.out.println(multipartFile);
//        String originalFilename = multipartFile.getOriginalFilename();
        //System.out.println(originalFilename+00000000000000000000000000);
        return qiniuUtils.upload(multipartFile);
    }
}
